package net.lzzy.practices.entities;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.*;
import java.util.ArrayList;
import java.util.List;
//题目类
@Entity
@NoArgsConstructor
@Setter
@Getter
//@No
public class Question extends  BaseEntity{
    @Transient
//    单选题
    public  static  final  int TYPE_SINQLE=0;
    @Transient
//    判断题
    public  static  final  int TYPE_JUDGE=1;
    @Transient
//    多选题目
    public  static  final  int TYPE_MANY=2;

    private  int type;

    private String content;

    private  int  ordinal;
//    cascade 指定直连
    @OneToMany(mappedBy = "question",cascade = CascadeType.PERSIST)
    private List<Option> options =new ArrayList<>();
    @ManyToOne
   private Chapter chapter;
    @OneToMany(mappedBy = "question")//    一个选项多个结果
    private  List<Result> results = new ArrayList<>();

}
